package com.xm.service;

import com.xm.dao.contactDao;
import com.xm.pojo.contact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class contactServiceImpl implements contactService{

    @Autowired
    private contactDao contactDao;


    /*用户地址列表*/
    @Override
    public List<contact> contactAll(int userId) {
        return contactDao.contactAll(userId);
    }

    /*修改地址*/
    @Override
    public boolean updateContact(contact contact) {
        return contactDao.updateContact(contact);
    }
    /*新增地址*/
    @Override
    public boolean addContact(contact contact) {
        return contactDao.addContact(contact);
    }
    /*删除地址*/
    @Override
    public boolean delContact(int id) {
        return contactDao.delContact(id);
    }
    /*删除地址（全部）*/
    @Override
    public boolean delContactAll(int userId) {
        return contactDao.delContactAll(userId);
    }

    @Override
    public boolean updateContectFalse(int contactFlag, int id) {
        return contactDao.updateContectFalse(contactFlag,id);
    }
    /*通过id查询地址信息*/
    @Override
    public contact findById(int id) {
        return contactDao.findById(id);
    }
    /*查询某个用户除某个联系人之外的地址信息*/
    @Override
    public List<contact> findAddressInfo(int userId, String name,String mobile,String address) {
        return contactDao.findAddressInfo(userId,name,mobile,address);
    }
}
